(function(window, demo_suggest) {
    var 
	Y = new Object();
    Y.F = function(oEvent) {
        if (window.event) {
            //事件冒泡阶段
            oEvent.eventPhase = 2;
            //静止事件冒泡
            oEvent.stopPropagation = function() { this.cancelBubble = true; };
            //当前对象
            oEvent.target = oEvent.srcElement;
        };
        return oEvent;
    };
    Y.G = function() {
        if (window.event) {
            return Y.F(window.event);
        } else {
            return Y.G.caller.arguments[0];
        };
    };
    var 
	_doc = document,
	_gid = function(t) {
	    return _doc.getElementById(t) || false;
	},
	_clm = function(o, t, a) {
	    var b = _doc.createElement(t || 'div');
	    for (var p in o) {
	        p == 'style' ? b[p].cssText = o[p] : b[p] = o[p];
	    };
	    return (a || _doc.body).appendChild(b);
	},
	_point = function(t) {
	    var x = t.offsetTop, y = t.offsetLeft;
	    while (t = t.offsetParent) { x += t.offsetTop; y += t.offsetLeft; };
	    return [x, y];
	},
	_eventBind = function(e, t, f) {
	    if (e.addEventListener) {
	        e.addEventListener(t, f, false);
	    } else {
	        e.attachEvent("on" + t, f);
	    };
	},
	_eventRemove = function(e, t, f) {
	    if (e.removeEventListener) {
	        e.removeEventListener(t, f, true);
	    } else {
	        e.detachEvent("on" + t, f);
	    };
	},
	_exec = function(f) {
	    return f();
	},
	_setClass = function(element, list) {
	    var ele;
	    ele = typeof (element) == "object" ? element : _gid(element);
	    for (var i in list) {
	        ele.style[i] = list[i];
	    };
	},
	_bre = {
	    $: null,
	    start: function(f) {
	        this.$ = setTimeout(
				f,
				300
			);
	    },
	    _setTimeout: function(f) {
	        this.$ ? clearTimeout(this.$) : "";
	        this.start(
				f
			);
	    }
	},
	_ajax = {
	    $: function() {
	        var val;
	        for (var i = 0; i < arguments.length; i++) {
	            var li = arguments[i];
	            try {
	                val = li();
	                break;
	            } catch (e) { }
	        }
	        return val;
	    },
	    C: function() {
	        return this.$(
				function() { return new ActiveXObject("Msxml2.XMLHTTP") },
            	function() { return new ActiveXObject("Microsoft.XMLHTTP") },
                function() { return new XMLHttpRequest() }
			) || false;
	    },
	    post: function(u, v, f) {
	        var 
			h = this.C();
	        h.open("POST", u, false);
	        h.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	        h.onreadystatechange = function() {
	            if (4 === h.readyState) {
	                if (200 === h.status) {
	                    return f(h.responseText);
	                }
	            };
	        };
	        v == null ? h.send(null) : h.send(v);
	    }
	},
	jElass = function() {
	    var 
		demo = this,
		demo_div,
		demo_input,
		demo_hidden,
		demo_dataList,
		demo_isMode,
		demo_index,
		demo_width,
		demo_bgColor,
		demo_error,
		demo_url,
		demo_back_function,
		demo_from,
		demo_x,
		demo_y,
		demo_o_font,
		demo_q_from,
	    demo_o_img;
	    demo.initialize = function(j) {
	        /*
	        保存输入框
	        **/
	        demo_input = _gid(j.input) || j.input;
	        /*
	        保存存值框
	        **/
	        demo_hidden = _gid(j.hidden) || j.hidden;
	        /*
	        数据保存
	        **/
	        demo_dataList = j.data || [];
	        /*
	        记录光标位置
	        **/
	        demo_index = 0;
	        /*
	        页面图片ID
	        **/
	        demo_o_img = _gid(j.oimg) || j.oimg;
	        /*
	        suggest层
	        **/
	        demo_div = _gid("demo_div_suggest_const") || _clm({
	            style: "border:#999 1px solid; \
							 position:absolute; \
							 padding: 3px 3px; \
							 z-index:100;\
							 background:#fff;\
							 top:0;\
							 left:0;\
							 width:0;\
							 display:none;",
	            id: "demo_div_suggest_const",
	            innerHTML: ""
	        }, null, null);
	        /*
	        是否获取异步数据
	        **/
	        demo_isMode = j.data ? false : true;
	        /*
	        宽度
	        **/
	        demo_width = j.width || 0;
	        /*
	        颜色值
	        **/
	        demo_bgColor = j.bc || { b: "#FF3300", c: "#ffffff" };
	        /*
	        错误
	        **/
	        demo_error = j.error || "不存在的数据";
	        /*
	        提交地址
	        **/
	        demo_url = j.url || "";
	        /*
	        提交参数
	        **/
	        demo_from = j.from || [];
	        /*
	        层关闭事件
	        **/
	        demo_back_function = j.bak || function(key, name) { /*bak 方法2个参数*/ };
	        /*
	        层 x y 移
	        **/
	        demo_x = j.x || 0;
	        demo_y = j.y || 0;
	        /*
	        推荐文字
	        **/
	        demo_o_font = j.tont || "推荐";
	        /*
	        增加提交值
	        **/
	        demo_add_value = j.addValue || "";
	        /*
	        增加提交值
	        **/
	        if (demo_add_value != "") {
	            demo_from.push("addquery=" + escape(demo_add_value));
	        };
	        /*
            是否允许自由输入
            add by qiuzhicheng 20150612
            **/
	        demo_canFreeInput = j.canFreeInput ? true : false;
	    };
	    demo.bind = function() {
	        demo.dataBind();
	        _setClass(
				demo_div, {
				    display: "block",
				    top: (_point(demo_input)[0] + demo_input.offsetHeight + 2) + (demo_y) + "px",
				    left: (_point(demo_input)[1] + (demo_x) + "px"),
				    width: (demo_input.offsetWidth - 8) + (demo_width) + "px",
				    height: demo_dataList.length > 6 ? '204px' : 'auto',
				    overflow: demo_dataList.length > 6 ? 'auto' : 'visible'
				}
			);
	    };
	    demo.seach = function(g) {
	        if (!g) {
	            var 
				oEvent = Y.G(),
				f = oEvent.keyCode;
	            if ((f < 65 && f != 8 && f != 0 && f != 46 && f != 32) || f > 90) {
	                return false;
	            };
	        };
	        _setClass(
				demo_div, {
				    top: (_point(demo_input)[0] + demo_input.offsetHeight + 2) + "px",
				    left: (_point(demo_input)[1] + (demo_x) + "px"),
				    width: (demo_input.offsetWidth - 8) + (demo_width) + "px"
				}
			);
	        _bre._setTimeout(function() {
	            _ajax.post(
					demo_url,
					demo_from.join("&") + "&query=" + demo_input.value.replace(/(^\s*)|(\s*$)/g, ""),
					function(date) {
					    _setClass(demo_div, { display: "block" });
					    demo_dataList = eval(date);
					    demo.dataBind();
					}
				)
	        });
	    };
	    demo.exec = function(J) {
	        demo.initialize(J);
	        /*
	        需要向服务器提交数据
	        **/
	        if (demo_isMode) {
	            demo.seach(true);
	            demo_input.onkeyup = demo.seach;
	        } else {
	            /*
	            默认的设置点击事件
	            **/

	            demo_input.onclick = function() {
	                /*
	                使用默认数据
	                **/

	                demo.bind();
	            };
	        };
	        _doc.onmousedown = function(e) {
	            if (!demo.isOnScrollbar(e)) demo.getValue(178);
	        };
	        window.onreset = function() {
	            demo.getValue();
	        };
	    };
	    demo.getRow = function() {
	        var v = -1;
	        for (
				var 
				i = 0,
				l = demo_dataList.length;
				i < l;
				i++
			) {
	            if (demo_hidden.value.replace(/(^\s*)|(\s*$)/g, "") == demo_dataList[i].Key.replace(/(^\s*)|(\s*$)/g, "")) {
	                return i;
	                break;
	            };
	        };
	        return v;
	    };
	    demo.dataBind = function() {
	        demo.clearItem();
	        demo_index = 0;
	        if (demo_dataList.length <= 0) {
	            demo_div.innerHTML = "\
					<p style=\"overflow:hidden;padding:8px 5px 5px;color:#ffffff; background:#cc0000;\">" + demo_error + "</p>\
				";
	            _doc.onkeydown = null;

	        } else {
	            var x = "background:" + demo_bgColor.b + "; color:" + demo_bgColor.c + ";",
				y = "background:#ffffff; color:#555555;",
				h = demo.getRow();
	            for (
					var 
					b,
					l = demo_dataList.length,
					i = 0;
					i < l;
					i = i + 1
				) {
	                b = _doc.createElement("P");
	                b.style.cssText = (demo_dataList[i].Pic ? "height:34px;padding:1px;" : "height:12px;padding:8px 0 8px 3px;") +
	                                  (h == -1 ? (i == 0 ? x : y) : (i == h ? x : y)) + "\
									   font-family:SimSun;\
									   overflow:hidden; \
									   cursor:pointer;";
	                b.innerHTML = ""
	                    + (demo_dataList[i].Pic ?
						"<span style=\"float:left; display:block; padding:3px 5px; background-color:#fff;\"><img src=\"" + demo_dataList[i].Pic + "\"></span><span style=\"float:left; display:block; line-height:34px; font-size:12px; padding:0 0 0 8px;\">" + demo_dataList[i].Name + "</span>" :
						"<span style=\"float:left; display:block; font-size:12px;\">" + demo_dataList[i].Name + "</span>")
						+ (demo_dataList[i].Flag ? "<span style=\"float:left; display:block; padding:0 0 0 9px; color:#ff0062\">" + demo_o_font + "</span>" : "") + "\
					";
	                h == -1 ? demo_index = 0 : demo_index = h;

	                (function(_) {
	                    b.onmouseover = function() {
	                        demo_index = _;
	                        for (var 
							o = 0,
							l = demo_div.getElementsByTagName("P");
							o < l.length;
							o++
							) {
	                            l[o].style.background = (_ == o ? demo_bgColor.b : demo_bgColor.c);
	                            l[o].style.color = (_ == o ? "#ffffff" : "#555555");
	                        };
	                    };
	                    b.onmousedown = function () {
	                        //edit by qiuzhicheng 20150612 begin
	                        //demo.getValue();
	                        demo.getValue('chooseItem');
	                        //edit by qiuzhicheng 20150612 end
	                    };
	                } (i));
	                demo_div.appendChild(b);
	            };
	            _doc.onkeydown = function(e) {
	                DOM_Key_Up_EXEC(e);
	            };
	        };
	    };
	    demo.getScrollbar = function() {
	        return {
	            left: demo_div.offsetLeft + demo_div.clientWidth,
	            top: demo_div.offsetTop,
	            width: demo_div.offsetWidth - demo_div.clientWidth,
	            height: demo_div.offsetHeight
	        }
	    };
	    demo.isOnScrollbar = function(e) {
	        var e = e || window.event;
	        var sb = demo.getScrollbar();
	        if (sb.left < e.pageX && e.pageX < (sb.left + sb.width) && sb.top < e.pageY && e.pageY < (sb.top + sb.height))
	            return true;
	        else
	            return false;
	    };
	    demo.clearItem = function() {
	        while (demo_div.hasChildNodes()) {
	            demo_div.removeChild(demo_div.firstChild);
	        }
	    };
	    demo.getValue = function(w) {
	        try {
	            if (demo_input.value.replace(/(^\s*)|(\s*$)/g, "") == "" && w == 178) {
	                demo_hidden.value = "";
	                demo_input.value = "";
	                demo_back_function("", "");
	                _doc.onkeydown = null;
	            } else if (demo_dataList.length > 0) {
                    //edit by qiuzhicheng 20150612 begin
	                //demo_back_function(demo_dataList[demo_index].Key, demo_dataList[demo_index].Name);
	                //demo_hidden.value = demo_dataList[demo_index].Key;
	                //demo_input.value = demo_dataList[demo_index].Name.replace(/\((.*)\)/gi, "");
	                if (!demo_canFreeInput) {//默认情况下，强制选中鼠标划过的项
	                    demo_back_function(demo_dataList[demo_index].Key, demo_dataList[demo_index].Name);
	                    demo_hidden.value = demo_dataList[demo_index].Key;
	                    demo_input.value = demo_dataList[demo_index].Name.replace(/\((.*)\)/gi, "");
	                } else {//可以自由输入
	                    if (w == 'chooseItem') {//鼠标点击，回车，赋值选中的项
	                        demo_back_function(demo_dataList[demo_index].Key, demo_dataList[demo_index].Name);
	                        demo_hidden.value = demo_dataList[demo_index].Key;
	                        demo_input.value = demo_dataList[demo_index].Name.replace(/\((.*)\)/gi, "");
	                    } else {//其余场合，将输入的值回传
	                        demo_hidden.value = demo_input.value;
	                        demo_back_function(demo_input.value, demo_input.value);
	                    }
	                }
	                //edit by qiuzhicheng 20150612 end
	                demo_dataList[demo_index].Pic && (demo_o_img.src = demo_dataList[demo_index].Pic);
	                _doc.onkeydown = null;
	            }
	            else {
	                //edit by qiuzhicheng 20150612 begin
	                //demo_hidden.value = "";
	                //demo_back_function("", "");
	                if (demo_canFreeInput) {//可以自由输入,将输入的值回传
	                    demo_hidden.value = demo_input.value;
	                    demo_back_function(demo_input.value, demo_input.value);
	                } else {
	                    demo_hidden.value = "";
	                    demo_back_function("", "");

                    }
	                //edit by qiuzhicheng 20150612 end
	                _doc.onkeydown = null;	                
	            }
	            _doc.body.removeChild(demo_div);
	            demo_input.blur();
	        } catch (e) {
	        };
	    };
	    function wri(text) {
	        demo_div.innerHTML = "\
				<p style=\"overflow:hidden; height:12px;padding:5px 5px;color:#ffffff; background:#ff0092;\">" + text + "</p>\
			";
	    };
	    function keyDOWN() {
	        var 
			i = 0,
			l = demo_div.getElementsByTagName("P");
	        if (demo_index >= l.length) {
	            demo_index = 0;
	        } else if (demo_index < 0) {
	            demo_index = l.length - 1;
	        };
	        for (; i < l.length; i = i + 1) {
	            l[i].style.background = (demo_index == i ? demo_bgColor.b : demo_bgColor.c);
	            l[i].style.color = (demo_index == i ? "#ffffff" : "#555555");
	        };
	        demo_input.value = demo_dataList[demo_index].Name;
	    };
	    function DOM_Key_Up_EXEC() {
	        var oEvent = Y.G();
	        switch (oEvent.keyCode) {
	            case 40:
	                demo_index++;
	                keyDOWN();
	                break;
	            case 38:
	                demo_index--;
	                keyDOWN();
	                break;
	            case 13:
	                //edit by qiuzhicheng 20150612 begin
	                //demo.getValue();
	                demo.getValue('chooseItem');
	                //edit by qiuzhicheng 20150612 end
	                break;
	        };
	    };
	};
    window.jElass = new jElass();
})(window);




var WcicyPick; (function() {
    var json = {
        '国内热门': [
			{ key: 'PVG', name: '上海' },
			{ key: 'PEK', name: '北京' },
			{ key: 'HKG', name: '香港' },
			{ key: 'CAN', name: '广州' },
			{ key: 'HGH', name: '杭州' },
			{ key: 'XMN', name: '厦门' },
			{ key: 'NKG', name: '南京' },
			{ key: 'MFM', name: '澳门' },
			{ key: 'CTU', name: '成都' },
			{ key: 'TAO', name: '青岛' },
			{ key: 'TPE', name: '台北' },
			{ key: 'FOC', name: '福州' },
			{ key: 'TSN', name: '天津' },
			{ key: 'SZX', name: '深圳' },
			{ key: 'DLC', name: '大连' },
			{ key: 'SHE', name: '沈阳' },
			{ key: 'KMG', name: '昆明' },
			{ key: 'WUH', name: '武汉' },
			{ key: 'NGB', name: '宁波' },
			{ key: 'WUX', name: '无锡' },
			{ key: 'JJN', name: '晋江' },
			{ key: 'CKG', name: '重庆' },
			{ key: 'SYX', name: '三亚' },
			{ key: 'SIA', name: '西安' }
		],
        '国际热门': [
			{ key: 'HKG', name: '香港' },
			{ key: 'ICN', name: '首尔仁川' },
			{ key: 'TPE', name: '台北' },
			{ key: 'NRT', name: '东京成田' },
			{ key: 'SIN', name: '新加坡' },
			{ key: 'MFM', name: '澳门' },
			{ key: 'BKK', name: '曼谷' },
			{ key: 'OSA', name: '大阪' },
			{ key: 'SGN', name: '胡志明市' },
			{ key: 'MNL', name: '马尼拉' },
			{ key: 'NGO', name: '名古屋' },
			{ key: 'LON', name: '伦敦' },
			{ key: 'KUL', name: '吉隆坡' },
			{ key: 'PUS', name: '釜山' },
			{ key: 'SYD', name: '悉尼' },
			{ key: 'FRA', name: '法兰克福' },
			{ key: 'YVR', name: '温哥华' },
			{ key: 'CDG', name: '巴黎' },
			{ key: 'JFK', name: '纽约' },
			{ key: 'LAX', name: '洛杉矶' },
			{ key: 'HNL', name: '夏威夷' }
		],
        '亚洲': [
			{ key: 'HKG', name: '香港' },
			{ key: 'NRT', name: '东京成田' },
			{ key: 'TPE', name: '台北' },
			{ key: 'ICN', name: '首尔仁川' },
			{ key: 'SIN', name: '新加坡' },
			{ key: 'BKK', name: '曼谷' },
			{ key: 'KUL', name: '吉隆坡' },
			{ key: 'KIX', name: '大阪' },
			{ key: 'MFM', name: '澳门' },
			{ key: 'CGK', name: '雅加达' },
			{ key: 'SGN', name: '胡志明市' },
			{ key: 'MNL', name: '马尼拉' },
			{ key: 'DPS', name: '巴厘岛' },
			{ key: 'NGO', name: '名古屋' },
			{ key: 'HKT', name: '普吉岛' },
			{ key: 'HAN', name: '河内' },
			{ key: 'MLE', name: '马累' },
			{ key: 'DXB', name: '迪拜' },
			{ key: 'PUS', name: '釜山' },
			{ key: 'KTM', name: '加德满都' },
			{ key: 'KHH', name: '高雄' },
			{ key: 'FUK', name: '福冈' },
			{ key: 'PNH', name: '金边' },
			{ key: 'DEL', name: '德里' },
			{ key: 'CJU', name: '济州岛' },
			{ key: 'SPK', name: '札幌' },
			{ key: 'IST', name: '伊斯坦布尔' },
			{ key: 'ULN', name: '乌兰巴托' },
			{ key: 'BOM', name: '孟买' }
		],
        '欧洲': [
			{ key: 'LHR', name: '伦敦' },
			{ key: 'PAR', name: '巴黎' },
			{ key: 'FRA', name: '法兰克福' },
			{ key: 'SVO', name: '莫斯科' },
			{ key: 'FCO', name: '罗马' },
			{ key: 'AMS', name: '阿姆斯特丹' },
			{ key: 'MXP', name: '米兰' },
			{ key: 'MUC', name: '慕尼黑' },
			{ key: 'ARN', name: '斯德哥尔摩' },
			{ key: 'TXL', name: '柏林' },
			{ key: 'MAN', name: '曼彻斯特' },
			{ key: 'MAD', name: '马德里' },
			{ key: 'ZRH', name: '苏黎世' },
			{ key: 'BRU', name: '布鲁塞尔' },
			{ key: 'CPH', name: '哥本哈根' },
			{ key: 'HEL', name: '赫尔辛基' },
			{ key: 'VIE', name: '维也纳' },
			{ key: 'BCN', name: '巴塞罗那' },
			{ key: 'ATH', name: '雅典' },
			{ key: 'EDI', name: '爱丁堡' },
			{ key: 'BHX', name: '伯明翰' },
			{ key: 'NCL', name: '纽卡斯尔' },
			{ key: 'GVA', name: '日内瓦' },
			{ key: 'LED', name: '圣彼得堡' },
			{ key: 'GLA', name: '格拉斯哥' },
			{ key: 'KBP', name: '基辅' },
			{ key: 'BUD', name: '布达佩斯' },
			{ key: 'HAM', name: '汉堡' },
			{ key: 'PRG', name: '布拉格' },
			{ key: 'DUS', name: '杜塞尔多夫' }
		],
        '美洲': [
			{ key: 'NYC', name: '纽约' },
			{ key: 'LAX', name: '洛杉矶' },
			{ key: 'SFO', name: '旧金山' },
			{ key: 'YVR', name: '温哥华' },
			{ key: 'ORD', name: '芝加哥' },
			{ key: 'YYZ', name: '多伦多' },
			{ key: 'SEA', name: '西雅图' },
			{ key: 'IAD', name: '华盛顿' },
			{ key: 'BOS', name: '波士顿' },
			{ key: 'DTW', name: '底特律' },
			{ key: 'ATL', name: '亚特兰大' },
			{ key: 'HOU', name: '休斯敦' },
			{ key: 'YMQ', name: '蒙特利尔' },
			{ key: 'HNL', name: '夏威夷·火奴鲁鲁' },
			{ key: 'SPN', name: '塞班' },
			{ key: 'DFW', name: '达拉斯' },
			{ key: 'MSP', name: '明尼阿波利斯' },
			{ key: 'PHL', name: '费城' },
			{ key: 'GRU', name: '圣保罗' },
			{ key: 'YOW', name: '渥太华' },
			{ key: 'MEX', name: '墨西哥城' },
			{ key: 'LAS', name: '拉斯维加斯' },
			{ key: 'YYC', name: '卡尔加里' },
			{ key: 'MIA', name: '迈阿密' },
			{ key: 'DEN', name: '丹佛' },
			{ key: 'ORL', name: '奥兰多' },
			{ key: 'PDX', name: '波特兰' },
			{ key: 'MHT', name: '曼彻斯特' },
			{ key: 'YEA', name: '埃德蒙顿' },
			{ key: 'EZE', name: '布宜诺斯艾利斯' }
		],
        '非洲': [
			{ key: 'CAI', name: '开罗' },
			{ key: 'JNB', name: '约翰内斯堡' },
			{ key: 'CPT', name: '开普敦' },
			{ key: 'NBO', name: '内罗毕' },
			{ key: 'LOS', name: '拉各斯' },
			{ key: 'LAD', name: '罗安达' },
			{ key: 'MRU', name: '毛里求斯' },
			{ key: 'DAR', name: '达累斯萨拉姆' },
			{ key: 'ADD', name: '亚的斯亚贝巴' },
			{ key: 'KRT', name: '喀土穆' },
			{ key: 'ACC', name: '阿克拉' },
			{ key: 'ALG', name: '阿尔及尔' },
			{ key: 'CMN', name: '卡萨布兰卡' },
			{ key: 'DUR', name: '德班' },
			{ key: 'TUN', name: '突尼斯' },
			{ key: 'LUN', name: '卢萨卡' },
			{ key: 'HRE', name: '哈拉雷' },
			{ key: 'NSI', name: '雅温得' },
			{ key: 'GBE', name: '哈博罗内' },
			{ key: 'FIH', name: '金沙萨' },
			{ key: 'MPM', name: '马普托' },
			{ key: 'DLA', name: '杜阿拉' },
			{ key: 'FNA', name: '费里敦' },
			{ key: 'ABJ', name: '阿比让' },
			{ key: 'LXR', name: '卢克索' }
		],
        '大洋洲': [
			{ key: 'SYD', name: '悉尼' },
			{ key: 'MEL', name: '墨尔本' },
			{ key: 'AKL', name: '奥克兰' },
			{ key: 'BNE', name: '布里斯班' },
			{ key: 'ADL', name: '阿德莱德' },
			{ key: 'PER', name: '珀斯' },
			{ key: 'WLG', name: '惠灵顿' },
			{ key: 'CBR', name: '堪培拉' },
			{ key: 'CNS', name: '凯恩斯' },
			{ key: 'NAN', name: '楠迪' },
			{ key: 'OOL', name: '黄金海岸' },
			{ key: 'PPT', name: '帕皮堤' },
			{ key: 'HBA', name: '霍巴特' },
			{ key: 'DRW', name: '达尔文' },
			{ key: 'DUD', name: '达尼丁' }
		]
    };
    var H, F, P, O = {};
    function G(o) {
        return !document.getElementById(o) ? null : document.getElementById(o);
    };
    function N(t, b) {
        var c = {};
        for (var x in t) { c[x] = t[x]; };
        for (var o in b) { c[o] = b[o]; };
        return c;
    };
    function S(e, l) {
        for (var i in l) {
            e.style[i] = l[i];
        };
    };
    function B(o, f, t) {
        if (o.addEventListener) { o.addEventListener(t, f, false); } else { o.attachEvent("on" + t, f); };
    };
    function Cl(o, a, t) {
        var b = document.createElement(t || 'div');
        for (var p in o) {
            p == 'style' ? b[p].cssText = o[p] : b[p] = o[p]
        };
        return a.appendChild(b);
    };
    function K() {
        if (O.target) {
            S(O.target, { display: 'none' });
        };
    };
    help = {
        /*
        大体模版
        **/
        temp: [
			'<div class=\'wcicy_head\'>',
			'	<div class=\'wcicy_head_tle\'><b>热门城市</b>(可直接输入城市或者城市拼音)</div>',
			'	<div class=\'wcicy_head_close\' id=\'WcicyPickClose\'>关闭</div>',
			'</div>',
			'<div class=\'wcicy_body\'>',
			'	<div class=\'wcicy_body_head\' id=\'WcicyPickHead\'>',
			'	</div>',
			'	<div class=\'wcicy_body_context\' id=\'WcicyPickBody\'></div>',
			'</div>'
		],
        /*
        构建一个对象
        **/
        createPick: function() {
            O.target = !G('WcicyPick') ? Cl({
                id: 'WcicyPick',
                onmousedown: function() { return false; },
                onselectstart: function() { return false; },
                onmousedown: function(e) {
                    var evt = e || window.event;
                    evt.stopPropagation ? evt.stopPropagation() : (evt.cancelBubble = true);
                }
            }, document.body, 'div') : G('WcicyPick');
            O.target.innerHTML = (function() {
                return help['temp'].join('');
            } ());
            O.targetClose = G('WcicyPickClose');
            O.targetBody = G('WcicyPickBody');
            O.targetHead = G('WcicyPickHead');
            function Wk() {
                var l = H.item, ln = l.length, i = 0, w, b, x, v, u, f, il = [], n;
                for (; i < ln; i++) {
                    w = json[l[i]];
                    v = w.length;
                    n = 'WPickItem' + (i + 1);
                    b = Cl({
                        className: 'wcicy_body_context_item',
                        id: n,
                        style: 'display:' + (i == H.zoom ? 'block' : 'none') + ';'
                    }, O.targetBody, 'div');
                    for (x = 0; x < v; x++) {
                        u = w[x];
                        f = Cl({
                            className: 'wcbc_node',
                            innerHTML: u.name,
                            title: u.name,
                            onmousemove: function() {
                                S(this, { color: '#ff0062' });
                            },
                            onmouseout: function() {
                                S(this, { color: '#666666' });
                            }
                        }, b, 'div');
                        (function(u) {
                            B(f, function() {
                                O.targetInput.value = u.name;
                                O.targetHidden.value = u.key;
                                H.click(u);
                                K();
                            }, 'click');
                        } (u));
                    };
                    il.push(b);
                };
                O.targetItem = il;
            };
            function Wh() {
                var l = H.item, ln = l.length, x = 0, w, v, hl = [], n;
                for (; x < ln; x++) {
                    w = l[x];
                    v = (x == H.zoom ? 'wc_body_item wc_body_item_focus' : 'wc_body_item');
                    n = 'WcicyButton' + (x + 1);
                    b = Cl({
                        className: v,
                        id: n,
                        innerHTML: w
                    }, O.targetHead, 'div');
                    hl.push(b);
                };
                O.targetHead = hl;
            };
            Wh();
            Wk();
            B(O.targetClose, K, 'click');
            help.xSwitch(O.targetHead, O.targetItem, 'wc_body_item wc_body_item_focus', 'wc_body_item');
        },
        xSwitch: function(m, p, c1, c2) {
            var a = m.length, b = p.length, x = 0, y;
            for (; x < a; x++) {
                m[x].value = x;
                m[x].onclick = function() {
                    for (y = 0; y < b; y++) {
                        m[y].className = c2;
                        p[y].style.display = 'none';
                    };
                    m[this.value].className = c1;
                    p[this.value].style.display = 'block';
                };
            };
        },
        xPoint: function(t) {
            var x = t.offsetTop, y = t.offsetLeft;
            while (t = t.offsetParent) { x += t.offsetTop; y += t.offsetLeft; };
            return [x, y];
        }
    };
    var Cfg = {
        zoom: 0,
        input: null,
        hidden: null,
        item: [
			'国内热门',
			'国际热门',
			'亚洲',
			'欧洲',
			'美洲',
			'非洲',
			'大洋洲'
		],
        x: 5,
        y: -5,
        click: function(x) { }
    };
    F = help.createPick;
    function P() {
        var x = help.xPoint(O.targetInput), t = x[0], l = x[1], h = O.targetInput.offsetHeight, mt = H.x, ml = H.y;
        S(O.target, {
            top: (t + h + mt) + 'px',
            left: (l + ml) + 'px',
            display: 'block'
        });
    };
    function U(c) {
        H = N(Cfg, c);
        if (!H.input || !H.hidden) return false;
        O.targetInput = (typeof H.input == 'object') ? H.input : G(H.input);
        O.targetHidden = (typeof H.hidden == 'object') ? H.input : G(H.hidden);
        F();
        P();
        B(document, K, 'mousedown');
    };
    WcicyPick = U;
    WcicyPick.hide = K;
})();